package com.teaching.teachingsupport.controller.studentcontroller;

import com.teaching.teachingsupport.common.pojo.dataobject.Course;
import com.teaching.teachingsupport.common.utils.SecurityUtils;
import com.teaching.teachingsupport.service.service2.studentservice.StudentCourseService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 学生课程控制器
 */
@RestController
@RequestMapping("/api/student/course")
@RequiredArgsConstructor
public class StudentCourseController {

    private final StudentCourseService studentCourseService;
    private final SecurityUtils securityUtils;

    /**
     * 获取学生所有课程列表
     */
    @GetMapping("/getStudentCourses")
    public List<Course> getStudentCourses() {
        return studentCourseService.getStudentCourses(securityUtils.getCurrentUserId());
    }

    /**
     * 获取学生当前学期课程列表
     */
    @GetMapping("/getCurrentSemesterCourses")
    public List<Course> getCurrentSemesterCourses() {
        return studentCourseService.getCurrentSemesterCourses(securityUtils.getCurrentUserId());
    }
}
